package com.itheim.array;
/*
   数组键入求和
 */

import java.util.Scanner;

public class ArrayDemo04 {
    public static void main(String[] args) {
        //创建输入
        Scanner sc = new Scanner(System.in);
        int arr[] = new int[5];
        //建立循环输入
        for (int i = 0; i < 5; i++) {
            System.out.println("请输入第" + (i + 1) + "个数字:");
            arr[i] = sc.nextInt();
        }
        //建立求和
        int sum = 0;
        for (int i = 0; i < 5; i++) {
            sum += arr[i];
        }
        System.out.println("这五个数的和是:"+sum);
    }
}
